<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/30
 * Time: 10:22
 */


/**
 * @desc 信息验证
 */
function authenticate($data,$sign){
    if($sign){
        ksort($data);
        if (isset($data['data']) && !empty($data['data'])){
            if (strstr($data['data'],'/')){
                $secureString = json_encode($data,JSON_UNESCAPED_SLASHES);
            }else{
                $secureString = json_encode($data,JSON_UNESCAPED_UNICODE);
            }
        }else{
            $secureString = json_encode($data,JSON_UNESCAPED_UNICODE);
        }
        if(md5($secureString.'huisanjiang') == $sign){
            return true;
        }
    }
    return false;
}